package com.iss.util;

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Date;

public class LoggerUtil {

    private static String loggerFile="F:\\workplace2021\\hotel\\src\\log.txt";
    private static final String  LINE_SEPARATOR ="\r\n";

    public static void write(String message){
        File file = new File(LoggerUtil.loggerFile);
        try {
            if(!file.exists()){
                file.createNewFile();
            }

            FileWriter fileWriter = new FileWriter(file,true);

            Date now = new Date();

            fileWriter.write(now.toString()+"\t"+message+LINE_SEPARATOR);

            fileWriter.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public static void  info(String message){
         LoggerUtil.write(message);
    }


}
